<!-- function show comment -->
		<?php

		$count_comments = count($comments);
		$stt = 0;
		?>
		<span style = "clear: both; text-align: right" class = 'reply_Comment' id = 'reply_Comment_0'style='float: right' value ='<?php echo $stt++ ?>'> <button style='float: right; margin-right: 8px; margin-bottom: 10px' class="btn btn-inverse" id='button_comment'>Add Comment</button> </span>
				
		<div class="form_comment" id='form_comment_0'> </div>
		<table width ='100%'  class='button_comment' id = 'button_comment_0'>	
			<tr>
				<td width ='20%' ></td>
				<td class='complete_comment' ><button  id='complete_comment_0' value='<?php echo $comments[$i]['cm_Product_Id'] ?>' type="submit" class="btn btn-success">Save</button></td>
			</tr>
		</table>
		<?php 
		for($i = 0 ;  $i< $count_comments - 1; $i++) { 
			if($comments[$i]['cm_Parent'] == 0) {
				?>
					<div class="comment-item">	
					<div class="avatar">
						<span><img border="0" height="50" width="50" src="http://2.1.s50.avatar.zdn.vn/avatar_files/2/1/b/e/thietvudinh77_50_2.jpg"/></span>
					</div>
					<p>
						<span class="nonchange"><a><?php echo $comments[$i]['cm_NameVisit']?></a></span>
						<span class="comment-time">Vào lúc <?php echo date('d/m/Y h:i:s A',strtotime($comments[$i]['cm_Date'])) ?></span>
						<span class="comment-content _contentComment"><?php echo($comments[$i]['cm_Detail'])?></span>
						<span class="dialog"></span>
						<span style = "clear: both; text-align: right" value ='<?php echo $stt++ ?>'  class = 'reply_Comment' id = 'reply_Comment_<?php echo($comments[$i]['cm_Id'])?>'style='float: right'> <a>Reply</a></span>

					</p> 
					</div>
					<div class="form_comment" id='form_comment_<?php echo($comments[$i]['cm_Id'])?>'> </div>
					<table class='button_comment' id = 'button_comment_<?php echo($comments[$i]['cm_Id'])?>'>	
						<tr>
							<td></td>
							<td class='complete_comment' ><button  id='complete_comment_<?php echo($comments[$i]['cm_Id'])?>' value='<?php echo ($comments[$i]['cm_Product_Id'])?>' type="submit" class="btn btn-success">Save</button></td>
						</tr>
					</table>
				<?php
			}

			for($j= $i + 1; $j < $count_comments; $j++) {
				if($comments[$j]['cm_Parent'] == $comments[$i]['cm_Id']) {
					?>
						<div class="sub_comment"> 
							<div class="comment-item">	
								<div class="avatar">
								<span><img border="0" height="50" width="50" src="http://2.1.s50.avatar.zdn.vn/avatar_files/2/1/b/e/thietvudinh77_50_2.jpg"/></span>
								</div>
								<p>
									<span class="nonchange"><a><?php echo $comments[$j]['cm_NameVisit']?></a></span>
									<span class="comment-time">Vào lúc <?php echo date('d/m/Y h:i:s A',strtotime($comments[$j]['cm_Date'])) ?></span>
									<span class="comment-content _contentComment"><?php echo($comments[$j]['cm_Detail'])?></span>
									<span class="dialog"></span>
								</p> 
							</div>
						</div>
					<?php
				}

			}
		}

		if($count_comments > 0 ) {
			if($comments[$count_comments -1]['cm_Parent'] == 0) { 
		?>
			<div class="comment-item">	
				<div class="avatar">
					<span><img border="0" height="50" width="50" src="http://2.1.s50.avatar.zdn.vn/avatar_files/2/1/b/e/thietvudinh77_50_2.jpg"/></span>
				</div>
				<p>
					<span class="nonchange"><a><?php echo $comments[$count_comments - 1]['cm_NameVisit']?></a></span>
					<span class="comment-time">Vào lúc <?php echo date('d/m/Y h:i:s A',strtotime($comments[$count_comments -1]['cm_Date'])) ?></span>
					<span class="comment-content _contentComment"><?php echo($comments[$count_comments -1]['cm_Detail'])?></span>
					<span class="dialog"></span>
					<span style = "clear: both; text-align: right" class = 'reply_Comment' id = 'reply_Comment_<?php echo($comments[$i]['cm_Id'])?>'style='float: right' value ='<?php echo $stt++ ?>'> <a>Reply</a></span>
					
				</p> 
			</div>
			<div class="form_comment" id='form_comment_<?php echo($comments[$i]['cm_Id'])?>'> </div>
			<table width ='100%'  class='button_comment' id = 'button_comment_<?php echo($comments[$i]['cm_Id'])?>'>	
				<tr>
					<td width ='20%' ></td>
					<td class='complete_comment' ><button  id='complete_comment_<?php echo($comments[$i]['cm_Id'])?>' value='<?php echo ($comments[$i]['cm_Product_Id'])?>' type="submit" class="btn btn-success">Save</button></td>
				</tr>
			</table>

		<?php 
			}
		}

		?>
		
	</div>
		<script src="<?php echo base_url()?>public/frontend/scripts/customer.js" type="text/javascript"></script>